<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	request.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加分类</title>
<link href="${pageContext.request.contextPath}/css/style.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-1.11.3.min.js"></script>
</head>
<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="${pageContext.request.contextPath}/right.action">首页</a></li>
			<li><a
				href="${pageContext.request.contextPath}/findCategoryList.action">用户列表</a></li>
		</ul>
	</div>
	<div class="formbody">
		<div class="formtitle">
			<span id="stype">${type}</span>
		</div>
		<form action="" name="ff" method="post" onsubmit="return checkValue()">
			<ul class="forminfo">
				<li><label style="width: 150px;">分类名称（<font
						style="color: Red; font-weight: bolder;">*</font>）：
				</label> <input name="categoryName" value="${category.categoryName}"
					type="text" class="dfinput" /></li>
				<i></i>

				<li><label>&nbsp;</label><input name="" id="submit"
					type="submit" class="btn" value="确认${type}" /> &nbsp;&nbsp;<input
					name="" type="button" onclick="goback();" class="btn" value="返回列表" /></li>
			</ul>
		</form>
	</div>
	<script>
		$("#submit")
				.click(
						function() {
							var text = $("#stype").text();
							if (text == "增加分类") {
								var path = "${pageContext.request.contextPath}/addCategory.action";
							} else if (text == "修改分类") {
								var path = "${pageContext.request.contextPath}/editCategory.action?categoryId=${category.categoryId}";
							}
							$('form').attr("action", path).submit();
						});
		function goback() {
			window.location.href = "${pageContext.request.contextPath}/findCategoryList.action";
		}
		function checkValue() {
			return true;
		}
	</script>
</body>
</html>